package nothing.model;

import java.util.Hashtable;
import java.util.List;

public class RecipeNutrition {

    private Recipe recipe;
    private Hashtable<FoodNutrition,Qty> nutritionList;
    private List<FoodNutrition> unKnownFoodNutrition;
    private List<MeasurementRatio> unKnownRatio;

	public RecipeNutrition(Recipe recipe, Hashtable<FoodNutrition,Qty> nutritionList,
			List<FoodNutrition> unKnownFoodNutrition, 
			List<MeasurementRatio> unKnownRatio) {
        this.recipe = recipe;
        this.nutritionList = nutritionList;
        this.unKnownFoodNutrition = unKnownFoodNutrition;
        this.unKnownRatio = unKnownRatio;
    }

	public List<FoodNutrition> getUnKnownFoodNutrition() {
		return unKnownFoodNutrition;
	}

	public void setUnKnownFoodNutrition(List<FoodNutrition> unKnownFoodNutrition) {
		this.unKnownFoodNutrition = unKnownFoodNutrition;
	}

	public List<MeasurementRatio> getUnKnownRatio() {
		return unKnownRatio;
	}

	public void setUnKnownRatio(List<MeasurementRatio> unKnownRatio) {
		this.unKnownRatio = unKnownRatio;
	}


    public Recipe getRecipe() {
        return recipe;
    }

    public void setRecipe(Recipe recipe) {
        this.recipe = recipe;
    }

    public Hashtable<FoodNutrition,Qty> getNutritionList() {
		return nutritionList;
	}

	public void setNutritionList(Hashtable<FoodNutrition,Qty> nutritionList) {
		this.nutritionList = nutritionList;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((nutritionList == null) ? 0 : nutritionList.hashCode());
		result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
		result = prime
				* result
				+ ((unKnownFoodNutrition == null) ? 0 : unKnownFoodNutrition
						.hashCode());
		result = prime * result
				+ ((unKnownRatio == null) ? 0 : unKnownRatio.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RecipeNutrition other = (RecipeNutrition) obj;
		if (nutritionList == null) {
			if (other.nutritionList != null)
				return false;
		} else if (!nutritionList.equals(other.nutritionList))
			return false;
		if (recipe == null) {
			if (other.recipe != null)
				return false;
		} else if (!recipe.equals(other.recipe))
			return false;
		if (unKnownFoodNutrition == null) {
			if (other.unKnownFoodNutrition != null)
				return false;
		} else if (!unKnownFoodNutrition.equals(other.unKnownFoodNutrition))
			return false;
		if (unKnownRatio == null) {
			if (other.unKnownRatio != null)
				return false;
		} else if (!unKnownRatio.equals(other.unKnownRatio))
			return false;
		return true;
	}

	public String toString() {
        return "Recipe Nutrition{" +
                "recipe=" + recipe + ", " +
                "Nutrition List=" + nutritionList +
                "}";
    }
}
